package com.learning.rpc.remoting.netty;

import com.learning.rpc.remoting.Client;
import com.learning.rpc.remoting.Codec;
import com.learning.rpc.remoting.Handler;
import com.learning.rpc.remoting.Server;
import com.learning.rpc.remoting.Transporter;

import java.net.URI;

/**
 * ClassName: NettyTransporter
 * Description:
 * Date: 2022/5/10 22:45 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
public class NettyTransporter implements Transporter {

    @Override
    public Server start(URI uri, Codec codec, Handler handler) {
        final NettyServer nettyServer = new NettyServer();
        nettyServer.start(uri, codec, handler);
        return nettyServer;
    }

    @Override
    public Client connect(URI uri, Codec codec, Handler handler) {
        final NettyClient nettyClient = new NettyClient();
        nettyClient.connect(uri, codec, handler);
        return nettyClient;
    }

}
